package day01;

import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class Example8 {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        env
                .fromElements(1,2,3,4,5,6,7,8).setParallelism(1)
                .rebalance()
                .print("rebalance: ").setParallelism(4);

        env
                .fromElements(1,2,3,4,5,6,7,8).setParallelism(1)
                .rescale()
                .print("rescale: ").setParallelism(4);
        env.execute();
    }
}
